package com.huiquan.icd.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.huiquan.framework.base.EnhancedBaseDao;
import com.huiquan.icd.domain.IcdCode;
import com.huiquan.icd.domain.IcdDiseaseGaoge;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository
public class IcdDiseaseGaogeDao extends EnhancedBaseDao<IcdCode> {

	@Resource(name = "sqlMapClient")
	private SqlMapClient sqlMapClient;

	public static final String space = "ICD_DISEASE_GAOGE.";

	public IcdDiseaseGaogeDao() {
		super(space);
	}

	public int retrieveSize(Map<String, Object> param) {
		return (Integer) this.object(space + "RETRIEVE_SIZE", param, sqlMapClient);
	}

	@SuppressWarnings("unchecked")
	public List<IcdDiseaseGaoge> retrievesList(Map<String, Object> param) {
		return (List<IcdDiseaseGaoge>) this.list(space + "RETRIEVE_LIST", param, sqlMapClient);
	}

	public void addGaogeDisease( Long uid, String disease,String gaogeName) {
		Map<String, Object> param = new HashMap<>();
		param.put("uid", uid);
		param.put("disease", disease);
		param.put("gaoge", gaogeName);
		update(space + "ADD_GAOGE_DISEASE", param, sqlMapClient);
	}
	
	public void deleteGaogeDisease( Long id) {
		Map<String, Object> param = new HashMap<>();
		param.put("id", id);
		update(space + "DELETE_GAOGE_DISEASE", param, sqlMapClient);
	}
	
	@SuppressWarnings("unchecked")
	public List<String> getAllDiseaseName() {
		Map<String, Object> param = new HashMap<>();
		return (List<String>) this.list(space + "SELECT_ALL_DISEASE_NAME", param, sqlMapClient);
	}
	
	public void deleteAll() {
		Map<String, Object> param = new HashMap<>();
		update(space + "DELETE_ALL", param, sqlMapClient);
	}
	
	public void batchInsert(List<IcdDiseaseGaoge> labelList) {
		this.insert(space + "BATCH_INSERT", labelList, sqlMapClient);
	}
}
